
'use strict'

const { Sequelize, DBPool } = require('./mysqldb')

const OperateLog = function() {
  return DBPool.define(
    'operate_log',
    {
      uid: {
        type: Sequelize.BIGINT,
        allowNull: false,
        defaultValue: 0
      },
      username: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: '',
        length: 255
      },
      role_id: {
        type: Sequelize.INTEGER,
        allowNull: false,
        defaultValue: 0
      },
      url: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: '',
        length: 1024
      },
      ua: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: '',
        length: 255
      },
      description: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: '',
        length: 5120
      }
    },
    {
      tableName: 'operate_log',
      timestamps: true
    }
  )
}

const TableOperateLog = new OperateLog()

module.exports = {
  TableOperateLog
}
